package com.winchain.chainbill.bill.biz.repurchase.rx;

import com.shell.bee.base.utils.StringUtil;
import com.shell.bee.file.utils.FileHelper;
import com.shell.framework.rx.OnErrorNotImplementedSubscriber;
import com.winchain.chainbill.bill.base.po.CbRpur;
import com.winchain.chainbill.bill.biz.Bill;
import com.winchain.chainbill.bill.biz.BillEvent;
import org.springframework.stereotype.Component;

@Component
public class BillRpurFileUploadSubscriber extends OnErrorNotImplementedSubscriber<BillEvent<CbRpur>> {
	public void onApplicationEvent(BillEvent<CbRpur> t) {
		CbRpur rpur = (CbRpur) t.getBill().getSource();
		if (rpur != null) {
			String fileIds = (String) t.getValue("fileIds");
			if (!StringUtil.emptyAndNull(fileIds)) {
				FileHelper.setRelateId(fileIds, rpur.getRpurId(), "5");
			}
		}
	}
}
